package com.i7jike.com.i7jike;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;


public class ProjectListActivity extends ListActivity {
//    private ListView projectListView;
    private String[] stringArray ;
    private ArrayAdapter projectItemArrayAdapter;

    //for tests
    private String[] mUrls= {
            "http://img.pconline.com.cn/images/upload/upc/tx/wallpaper/1308/12/c0/24385458_1376274219724_800x600.jpg",
            "http://img.pconline.com.cn/images/upload/upc/tx/wallpaper/1308/12/c0/24385458_1376274219727_800x600.jpg",
            "http://img.pconline.com.cn/images/upload/upc/tx/wallpaper/1308/12/c0/24385458_1376274219721_800x600.jpg",
            "http://a.hiphotos.baidu.com/image/pic/item/7af40ad162d9f2d3872945efabec8a136327ccf2.jpg",
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_project_list);

//        stringArray = new String[10];
//        for(int i=0; i < stringArray.length; i++){
//            stringArray[i] = "String " + i;
//        }
//        projectItemArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, stringArray);
        projectItemArrayAdapter =new ProjectAdapter(this, mUrls);
 //       projectListView = (ListView) findViewById(R.id.projectList);
 //       projectListView.setAdapter(projectItemArrayAdapter);
        setListAdapter(projectItemArrayAdapter);
    }
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        Intent intent = new Intent(this, ProjectDetailActivity.class);
        intent.putExtra("pURL", mUrls[position]);
        startActivity(intent);
    }
}
